package com.zoe.app.config;

import com.zoe.app.filter.MyFilter6;
import com.zoe.app.filter.MyFilter7;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Collections;

/**
 * @author Zoe.Zhang
 * @date 2021/10/10
 * @description
 */
@Configuration
public class FilterConfig {
    @Bean
    FilterRegistrationBean<MyFilter7> myFilter() {
        FilterRegistrationBean<MyFilter7> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setOrder(2);
        registrationBean.setFilter(new MyFilter7());
        registrationBean.setUrlPatterns(Collections.singletonList("/*"));
        return registrationBean;
    }

    @Bean
    FilterRegistrationBean<MyFilter6> myFilter6() {
        FilterRegistrationBean<MyFilter6> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setOrder(3);
        registrationBean.setFilter(new MyFilter6());
        registrationBean.setUrlPatterns(Collections.singletonList("/*"));
        return registrationBean;
    }
}
